package com.sky.controller.user;

import com.sky.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

//用户端

@RestController("UserShopController")//因为用户端可管理端有两个类，所以要重命名
@RequestMapping("/user/shop")
@Slf4j
@Api(tags = "店铺相关接口")
public class ShopController {

    private final static String KEY="SHOP_VALUE";

    @Autowired
    private RedisTemplate redisTemplate;

    //获取店铺状态
    @GetMapping("/status")
    @ApiOperation(value = "获取店铺状态")
    public Result<Integer> GetShopStatus(){
        log.info("获取店铺状态");
        String o = (String) redisTemplate.opsForValue().get(KEY);
        Integer Status=1;
        if (o!=null){
            Status =Integer.valueOf(o);
        }

        return Result.success(Status);
    }
}
